package com.wfg.expresscompany;

import com.wfg.expresscompany.Service.ShippingChannels;
import com.wfg.expresscompany.component.ShippingChannelsFactory;
import com.wfg.expresscompany.entity.Package;
import com.wfg.expresscompany.enums.ShippingChannelsEnum;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class ExpressCompanyApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ExpressCompanyApplication.class, args);
        ShippingChannelsFactory shippingChannelsFactory = context.getBean(ShippingChannelsFactory.class);

        // 静态获取汽车渠道进行运输服务
        ShippingChannels shippingChannels = ShippingChannelsFactory.getShippingChannels(ShippingChannelsEnum.CART);
        shippingChannels.transport(new Package("真人娃娃", "普快"));
    }
}
